package com.fuyun.microservice.config;


import com.alibaba.fastjson.JSON;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@ConfigurationProperties(prefix = "client")
@Data
@Slf4j
public class ClientPrivilegeProperties implements InitializingBean {
    private List<Privilege> privileges;

    @Override
    public void afterPropertiesSet() {
        log.info("client privileges:"+ JSON.toJSONString(this));
    }

    public static class  Privilege{
        private int id;
        private String secret;
        private String types;

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        public String getSecret() {
            return secret;
        }

        public void setSecret(String secret) {
            this.secret = secret;
        }

        public String getTypes() {
            return types;
        }

        public void setTypes(String types) {
            this.types = types;
        }
    }
}
